package com.hntech.base.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Autho changqi.wu
 * @Date 路在脚下，使劲踩！
 */
public class Test {

    public static void main(String[] args) throws IllegalAccessException, InstantiationException, InvocationTargetException {

//        Obj entity = Obj.class.newInstance(); //只能无参数的非private类型构造
//        System.out.println(entity);

        Constructor<?>[] construtor = Obj.class.getConstructors();
        for(Constructor c : construtor){

            c.setAccessible(true);

            try {

                Object ss = c.newInstance();
                System.out.println(ss);

            }catch (Exception e){
                e.printStackTrace();
            }
        }

    }

}
